<?php
class baseController {
	
	var $m_command;
	
	public function __construct($a_command){
		$this->m_command = $a_command;
	}
	
	function DefaultFunction(){		
		RestUtils::sendResponse("404", '<error>Sidan kunde inte hittas</error>', "text/xml");
		//echo"basecontroller";
	}
	function ErrorFunction(){
		RestUtils::sendResponse("404", '<error>Sidan kunde inte hittas</error>', "text/xml");
	}
	
	public function Execute(){
		$functionToCall = $this->m_command->getFunction();
		if($this->m_command->getFunction() == ""){
			$functionToCall = "DefaultFunction";			
		}elseif(!is_callable(array($this, $functionToCall))){
			$functionToCall = "ErrorFunction";
		}
		return call_user_func(array($this, $functionToCall), $this->m_command);
	}
}
